package com.gomtel.smartdevice.ui.dialog;

import android.content.Context;
import android.view.Gravity;
import android.view.Window;

import com.gomtel.smartdevice.R;
import com.gomtel.smartdevice.utils.SystemUtil;


/**
 * Created by Administrator on 2018/3/19.
 */

public class ShowDialog {

    private static ShowDialog instance = new ShowDialog();

    private ShowDialog() {
    }

    public static ShowDialog newInstance() {
        return instance;
    }

    public ProgressDialog showProgressStatus(final Context context, String content) {
        final ProgressDialog progressDialog = new ProgressDialog(context, R.style.dialog, content);
        progressDialog.setCanceledOnTouchOutside(true);
        Window window = progressDialog.getWindow();
        if (window != null) {
            window.setGravity(Gravity.CENTER);//此处可以设置dialog显示的位置
        }
        return progressDialog;
    }

    public void showGenderDialog(final Context context, int status) {
        final GenderDialog genderDialog = new GenderDialog(context, R.style.dialog, status);
        genderDialog.show();
        SystemUtil.windowToDark(context);
    }

    public void showDatepickerDialog(final Context context, String currentDate) {
        final DatepickerDialog datepickerDialog = new DatepickerDialog(context, R.style.dialog, currentDate);
        datepickerDialog.show();
        SystemUtil.windowToDark(context);
    }

    public void showStatusDialog(final Context context, int status) {
        final StatusDialog statusDialog = new StatusDialog(context, R.style.dialog, status);
        statusDialog.show();
        SystemUtil.windowToDark(context);
    }

    public void showBPCDialog(final Context context, int pvh, int ldo) {
        final BPCDialog bpcDialog = new BPCDialog(context, R.style.dialog, pvh, ldo);
        bpcDialog.show();
        SystemUtil.windowToDark(context);
    }

    public void showStepAboutDialog(final Context context) {
        final StepAboutDialog stepAboutDialog = new StepAboutDialog(context, R.style.dialog);
        stepAboutDialog.show();
        SystemUtil.windowToDark(context);
    }

    public void showLoopDialog(final Context context, int selectTime) {
        final LoopDialog loopDialog = new LoopDialog(context, R.style.dialog, selectTime);
        loopDialog.show();
    }
}
